<?php
/**
 *                    _ooOoo_
 *                   o8888888o
 *                   88" . "88
 *                   (| -_- |)
 *                    O\ = /O
 *                ____/`---'\____
 *              .   ' \\| |// `.
 *               / \\||| : |||// \
 *             / _||||| -:- |||||- \
 *               | | \\\ - /// | |
 *             | \_| ''\---/'' | |
 *              \ .-\__ `-` ___/-. /
 *           ___`. .' /--.--\ `. . __
 *        ."" '< `.___\_<|>_/___.' >'"".
 *       | | : `- \`.;`\ _ /`;.`/ - ` : | |
 *         \ \ `-. \_ __\ /__ _/ .-` / /
 * ======`-.____`-.___\_____/___.-`____.-'======
 *                    `=---='
 *
 * .............................................
 *          佛祖保佑             永无BUG
 */

namespace App\Repositories;


class WechatResposity
{
    protected $app;
    public function __construct()
    {
        $this->app= \EasyWeChat::officialAccount();
    }

    public function sendOne($openId,$message){


        $result = $this->app->customer_service->message($message)->to($openId)->send();

    }
    public function sendTpl($openId,$message){
        $message['touser']=$openId;
        $result= $this->app->template_message->send($message);
        if ($result['errcode']!=0){
            \Log::error('发送模板消息错误',$message);
        }
    }
}